<!--
 * @Author: ckk
 * @Date: 2022-08-11 13:38:58
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-07-20 16:13:04
 * @Description: 头部个人信息
-->
<template>
  <div class="use-info">
    <div class="use-infos">
      <div class="use-item">
        <img :src="imgUrl" alt="" />
        <div class="use-name" :style="{'color': (color?'#fff': 'rgba(0,0,0,0.8500)')}">
          <p>{{getDecode(userInfo.bizRealname)}}</p>
          <p class="use-tips" :style="{'color': (color?'#fff': 'rgba(0,0,0,0.8500)')}">{{datas.setStyle.briefIntroduction}}</p>
        </div>
      </div>
      <div class="imglist">
        <img class="youbi" :src="item.iconPic" alt=""  v-for="(item,index) in datas.setStyle.iconList" :key="index"/>
      </div>
    </div>
  </div>
</template>

<script>
import { getAuthTokenUserInfo } from '@/utils';
import { userServices } from '@/api';
import aes from '@/utils/aes';
export default {
  name: 'courseItem',
  props: {
    datas: Object,
    color: String
  },
  data () {
    return {
      userInfo: {},
      size: 100,
      imgUrl: require('@/assets/images/avatar_default.png') // 头像默认图片
    };
  },
  created () {
    this.userInfo = getAuthTokenUserInfo();
    this.getHeadPhoto();
  },
  methods: {
    getDecode (name) {
      return aes.decode(name) || '';
    },
    async getHeadPhoto () {
      const res = await userServices.getHeadPhoto(this.userInfo.bizUsername, this.size);
      this.imgUrl = res;
    }
  }
};
</script>

<style scoped lang="scss">
.use-infos{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left:15px;
    padding-right:26px;
    padding-top:15px;
    padding-bottom:10px;
    .use-item{
       display: flex;
       align-items: center;
       img{
        width: 48px;
        height: 48px;
        border-radius: 50%;
        overflow: hidden;
        margin-right:15px;
       }
    }
    .use-name{
        font-size: 16px;
        font-weight: 500;
        line-height: 19px;
        color: rgba(0,0,0,0.8500);
        .use-tips{
            font-size: 12px;
font-weight: 400;
color: #666666;
line-height: 14px;
margin-top:6px
        }
    }
    .youbi{
        width: 20px;
height: 20px;
margin-left:10px;
    }
}
.imglist{
  display: flex;
  align-items: center;
}
</style>
